﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
namespace CMN.Entity
{
      ///<summary>
    ///Normal_VoteEntity实体类(投票)
    ///</summary>
    [Serializable]
    public partial class Normal_VoteEntity
    {
        #region "Private Variables"
        private DataTableAction _DataTable_Action;  // 操作方法 Insert:增加 Update:修改 Delete:删除
        private Int32 _Id=0; // 递增Id
        private String _Title=""; // 标题
        private String _VoteText=""; // 投票列表
        private bool _Type=false; // 类型 多选 单选
        private bool _Enabled=false; // 是否启用
        private String _Description=""; // 投票简介
        private bool _AllowGuest=false; // 允许游客投票
        private DateTime _AddDate=DateTime.Now; // 添加时间
        private DateTime _EndDate=DateTime.Now; // 结束时间
        private DateTime _StartDate=DateTime.Now; // 开始时间
        private bool _AllowView=false; // 允许查看投票结果
        private int _Interval=0; // 投票时间间隔 0 表示此IP地址只能投一次
        private Int32 _TemplateId=0; // 
        private Int32 _UserId=0; // 
        #endregion

        #region "Public Variables"
        ///<summary>
        /// 操作方法 Insert:增加 Update:修改 Delete:删除
        ///</summary>
        public DataTableAction DataTable_Action
        {
            set { this._DataTable_Action = value; }
            get { return this._DataTable_Action; }
        }
        /// <summary>
        /// 递增Id
        /// </summary>
        public Int32  Id
        {
            set { this._Id = value; }
            get { return this._Id; }
        }
        /// <summary>
        /// 标题
        /// </summary>
        public String  Title
        {
            set { this._Title = value; }
            get { return this._Title; }
        }
        /// <summary>
        /// 投票列表
        /// </summary>
        public String  VoteText
        {
            set { this._VoteText = value; }
            get { return this._VoteText; }
        }
        /// <summary>
        /// 类型 多选 单选
        /// </summary>
        public bool  Type
        {
            set { this._Type = value; }
            get { return this._Type; }
        }
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool  Enabled
        {
            set { this._Enabled = value; }
            get { return this._Enabled; }
        }
        /// <summary>
        /// 投票简介
        /// </summary>
        public String  Description
        {
            set { this._Description = value; }
            get { return this._Description; }
        }
        /// <summary>
        /// 允许游客投票
        /// </summary>
        public bool  AllowGuest
        {
            set { this._AllowGuest = value; }
            get { return this._AllowGuest; }
        }
        /// <summary>
        /// 添加时间
        /// </summary>
        public DateTime  AddDate
        {
            set { this._AddDate = value; }
            get { return this._AddDate; }
        }
        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime  EndDate
        {
            set { this._EndDate = value; }
            get { return this._EndDate; }
        }
        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime  StartDate
        {
            set { this._StartDate = value; }
            get { return this._StartDate; }
        }
        /// <summary>
        /// 允许查看投票结果
        /// </summary>
        public bool  AllowView
        {
            set { this._AllowView = value; }
            get { return this._AllowView; }
        }
        /// <summary>
        /// 投票时间间隔 0 表示此IP地址只能投一次
        /// </summary>
        public int  Interval
        {
            set { this._Interval = value; }
            get { return this._Interval; }
        }
        /// <summary>
        /// 
        /// </summary>
        public Int32  TemplateId
        {
            set { this._TemplateId = value; }
            get { return this._TemplateId; }
        }
        /// <summary>
        /// 
        /// </summary>
        public Int32  UserId
        {
            set { this._UserId = value; }
            get { return this._UserId; }
        }

        public List<VoteInfo> VoteInfos
        {
            get;
            set;
        }
        #endregion
    }

    /// <summary>
    /// 投票选项
    /// </summary>
    public class VoteInfo:ISerializable 
    {


        
        public VoteInfo()
        {

        }
        public VoteInfo(SerializationInfo info, StreamingContext content)
        {
            Id = info.GetInt32("Id");
            Num = info.GetInt32("Num");
            Title = info.GetString("Title");


        }


        public virtual void GetObjectData(SerializationInfo info, StreamingContext content)
        {
            info.AddValue("Id", Id);
            info.AddValue("Title", Title);
            info.AddValue("Num", Num);

        }
        /// <summary>
        /// 投票Id
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 投票选项
        /// </summary>
        public string Title { get; set; }
        /// <summary>
        /// 投票数
        /// </summary>
        public int Num { get; set; }
    }
}
